<template>
<Select :value="value" size="small" @on-change="handleOnChange">
    <Option v-for="(item, index) in commodityWares" :key="index" :value="item.value">{{ item.label }}</Option>
</Select>
</template>

<script lang="ts">
import { Component, Vue,Inject, Prop,Watch } from 'vue-property-decorator';
import AbpBase from '../../lib/abpbase'

@Component
export default class CommodityWareSelect extends AbpBase{
    @Prop() model:any;
    @Prop({type:String,default:'commodityWareId'}) prop:String;
    get commodityWares() {
        return this.$store.state.setting.settings.commodityWares.reduce((result, elem) => { 
			result.push({ value: elem.id, label: elem.name });
			return result;
		}, [{ value: 0, label: "全部" }]);
    }
    get value() {
        return this.model[this.prop.toString()];
    }
    handleOnChange(value) {
        this.model[this.prop.toString()] = value;
    }
}
</script>

<style>

</style>
